package com.twb.core.base.entity;

import java.io.Serializable;
import java.util.List;

import com.github.pagehelper.PageInfo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/** 
 * @ClassName TwbPageInfo 
 * @Description 分页对象
 * @author DSY
 * @date 2018年11月3日 下午9:25:14 
 */ 
@ApiModel(value="TwbPageInfo",description="分页出参对象")
public class TwbPageInfo<T> implements Serializable {

	private static final long serialVersionUID = 1L;
	
	//当前页
	@ApiModelProperty("当前页")
    private int pageNum;
    //每页的数量
	@ApiModelProperty("每页的数量")
    private int pageSize;
    //当前页的数量
	@ApiModelProperty("当前页的数量")
    private int size;

    //由于startRow和endRow不常用，这里说个具体的用法
    //可以在页面中"显示startRow到endRow 共size条数据"

    //当前页面第一个元素在数据库中的行号
	@ApiModelProperty("当前页面第一个元素在数据库中的行号")
    private Long startRow;
    //当前页面最后一个元素在数据库中的行号
	@ApiModelProperty("当前页面最后一个元素在数据库中的行号")
    private Long endRow;
    //总页数
	@ApiModelProperty("总页数")
    private int pages;

    //前一页
	@ApiModelProperty("前一页")
    private int prePage;
    //下一页
	@ApiModelProperty("下一页")
    private int nextPage;

    //是否为第一页
	@ApiModelProperty("是否为第一页")
    private boolean isFirstPage = false;
    //是否为最后一页
	@ApiModelProperty("是否为最后一页")
    private boolean isLastPage = false;
    //是否有前一页
	@ApiModelProperty("是否有前一页")
    private boolean hasPreviousPage = false;
    //是否有下一页
	@ApiModelProperty("是否有下一页")
    private boolean hasNextPage = false;
    //导航页码数
	@ApiModelProperty("导航页码数")
    private int navigatePages;
    //所有导航页号
	@ApiModelProperty("所有导航页号")
    private int[] navigatepageNums;
    //导航条上的第一页
	@ApiModelProperty("导航条上的第一页")
    private int navigateFirstPage;
    //导航条上的最后一页
	@ApiModelProperty("导航条上的最后一页")
    private int navigateLastPage;
    
    //总记录数
	@ApiModelProperty("总记录数")
    private long total;
    //结果集
	@ApiModelProperty("结果集")
    private List<T> list;
	public TwbPageInfo() {}
    public TwbPageInfo(PageInfo<T> pageInfo) {
		this.pageNum = pageInfo.getPageNum();
		this.pageSize = pageInfo.getPageSize();
		this.size = pageInfo.getSize();
		this.startRow = pageInfo.getStartRow();
		this.endRow = pageInfo.getEndRow();
		this.pages = pageInfo.getPages();
		this.prePage = pageInfo.getPrePage();
		this.nextPage = pageInfo.getNextPage();
		this.isFirstPage = pageInfo.isIsFirstPage();
		this.isLastPage = pageInfo.isIsLastPage();
		this.hasPreviousPage = pageInfo.isHasPreviousPage();
		this.hasNextPage = pageInfo.isHasNextPage();
		this.navigatePages = pageInfo.getNavigatePages();
		this.navigateFirstPage = pageInfo.getNavigateFirstPage();
		this.navigateLastPage = pageInfo.getNavigateLastPage();
		this.list = pageInfo.getList();
		this.total = pageInfo.getTotal();
	}
    
	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getSize() {
		return size;
	}

	public void setSize(int size) {
		this.size = size;
	}

	public Long getStartRow() {
		return startRow;
	}

	public void setStartRow(Long startRow) {
		this.startRow = startRow;
	}

	public Long getEndRow() {
		return endRow;
	}

	public void setEndRow(Long endRow) {
		this.endRow = endRow;
	}

	public int getPages() {
		return pages;
	}

	public void setPages(int pages) {
		this.pages = pages;
	}

	public int getPrePage() {
		return prePage;
	}

	public void setPrePage(int prePage) {
		this.prePage = prePage;
	}

	public int getNextPage() {
		return nextPage;
	}

	public void setNextPage(int nextPage) {
		this.nextPage = nextPage;
	}

	public boolean isFirstPage() {
		return isFirstPage;
	}

	public void setFirstPage(boolean isFirstPage) {
		this.isFirstPage = isFirstPage;
	}

	public boolean isLastPage() {
		return isLastPage;
	}

	public void setLastPage(boolean isLastPage) {
		this.isLastPage = isLastPage;
	}

	public boolean isHasPreviousPage() {
		return hasPreviousPage;
	}

	public void setHasPreviousPage(boolean hasPreviousPage) {
		this.hasPreviousPage = hasPreviousPage;
	}

	public boolean isHasNextPage() {
		return hasNextPage;
	}

	public void setHasNextPage(boolean hasNextPage) {
		this.hasNextPage = hasNextPage;
	}

	public int getNavigatePages() {
		return navigatePages;
	}

	public void setNavigatePages(int navigatePages) {
		this.navigatePages = navigatePages;
	}

	public int[] getNavigatepageNums() {
		return navigatepageNums;
	}

	public void setNavigatepageNums(int[] navigatepageNums) {
		this.navigatepageNums = navigatepageNums;
	}

	public int getNavigateFirstPage() {
		return navigateFirstPage;
	}

	public void setNavigateFirstPage(int navigateFirstPage) {
		this.navigateFirstPage = navigateFirstPage;
	}

	public int getNavigateLastPage() {
		return navigateLastPage;
	}

	public void setNavigateLastPage(int navigateLastPage) {
		this.navigateLastPage = navigateLastPage;
	}

	public long getTotal() {
		return total;
	}

	public void setTotal(long total) {
		this.total = total;
	}

	public List<T> getList() {
		return list;
	}

	public void setList(List<T> list) {
		this.list = list;
	}

}
